From: Lubomir Rintel Date: Thu, 11 Jan 2018 09:50:45 +0000 (+0100) Subject: network: initialize the agent asynchronously X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~929^2~5^2~82 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c82cb918ae8d2dc0b737dc83d4669d3e4bd15ef0;p=gnome-shell.git network: initialize the agent asynchronously This also bumps the NM requirement. We actually already use API from 1.0, but regularly hit various NetworkManager bugs with versions prior to 1.10.2. 1.10.4 fixes the asynchronous agent initialization. https://bugzilla.gnome.org/show_bug.cgi?id=789811 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/63 --- diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index 75f420373..9050b8a50 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -604,12 +604,17 @@ var NetworkAgent = new Lang.Class({ this._native.connect('new-request', this._newRequest.bind(this)); this._native.connect('cancel-request', this._cancelRequest.bind(this)); - try { - this._native.init(null); - } catch(e) { - this._native = null; - logError(e, 'error initializing the NetworkManager Agent'); - } + + this._initialized = false; + this._native.init_async(GLib.PRIORITY_DEFAULT, null, (o, res) => { + try { + this._native.init_finish(res); + this._initialized = true; + } catch(e) { + this._native = null; + logError(e, 'error initializing the NetworkManager Agent'); + } + }); }, enable() { @@ -617,7 +622,7 @@ var NetworkAgent = new Lang.Class({ return; this._native.auto_register = true; - if (!this._native.registered) + if (this._initialized && !this._native.registered) this._native.register_async(null, null); }, @@ -640,7 +645,7 @@ var NetworkAgent = new Lang.Class({ return; this._native.auto_register = false; - if (this._native.registered) + if (this._initialized && this._native.registered) this._native.unregister_async(null, null); }, diff --git a/meson.build b/meson.build index bfc2ff76c..1c0b68c71 100644 --- a/meson.build +++ b/meson.build @@ -31,7 +31,7 @@ ibus_req = '>= 1.5.2' bt_req = '>= 3.9.0' gst_req = '>= 0.11.92' -nm_req = '>= 0.9.8' +nm_req = '>= 1.10.4' secret_req = '>= 0.18' gnome = import('gnome')